API Documentation
Public Member Functions | List of all members
nkGraphics::BufferManager Class Reference

Manages the buffers declared within the component. More...

Inheritance diagram for nkGraphics::BufferManager:

Public Member Functions

 ~BufferManager ()
 
BuffercreateOrRetrieve (const std::string_view &name)
 
Bufferget (const std::string_view &name)
 
BuffergetByIndex (unsigned int index)
 
void rename (const std::string_view &oldName, const std::string_view &newName)
 
void erase (const std::string_view &name)
 

Detailed Description

Manages the buffers declared within the component.

Buffer creation / deletion needs to go through this class, to be sure created Buffers are the right one for the active Renderer. Like any Manager, it is always owning the memory it returns. External code should never allocate or deallocate buffers without calling this class' methods.

Constructor & Destructor Documentation

◆ ~BufferManager()

nkGraphics::BufferManager::~BufferManager ( )

Destructor. In theory, should never be called by external code. If really needed, call the SingletonClass<>::kill() method.

Member Function Documentation

◆ createOrRetrieve()

Buffer* nkGraphics::BufferManager::createOrRetrieve ( const std::string_view &  name)

Creates if unavailable, or retrieves if available, buffer with given name.

Parameters
nameThe name of the buffer to create or retrieve.
Returns
The buffer requested.
Remarks
The manager owns the memory returned. External code should never free it. See erase() if needed.

◆ get()

Buffer* nkGraphics::BufferManager::get ( const std::string_view &  name)

Retrieves buffer identified by given name.

Parameters
nameThe name of the buffer to retrieve.
Returns
The buffer if available, nullptr else.

◆ getByIndex()

Buffer* nkGraphics::BufferManager::getByIndex ( unsigned int  index)

Retrieves a buffer, by index.

Parameters
indexThe index of the buffer to retrieve.
Returns
The buffer if available, nullptr else.
Remarks
For one given index, manipulating the memory through creating or erasing a buffer could change the buffer retrieved. Mainly used to loop through all buffers in memory, in one go.

◆ rename()

void nkGraphics::BufferManager::rename ( const std::string_view &  oldName,
const std::string_view &  newName 
)

Renames a buffer, both changing the way to access it from the manager and the name set on the buffer.

Parameters
oldNameThe name to change from.
newNameThe name to change to.

◆ erase()

void nkGraphics::BufferManager::erase ( const std::string_view &  name)

Erases a buffer, freeing its memory.

Parameters
nameThe name of the buffer to erase.

The documentation for this class was generated from the following file: